<template>
  <view class="list">
    <view class="content">
      <view class="goods_item" v-for="item in list" :key="item.goods_id"
        @click="clickListItem(item.goods_id)">
        <view class="goods_img_wrap">
          <image mode="widthFix" :src="
              item.goods_small_logo
                ? item.goods_small_logo
                : 'https://ww1.sinaimg.cn/large/007rAy9hgy1g24by9t530j30i20i2glm.jpg'
            "></image>
        </view>
        <view class="goods_info_wrap">
          <view class="goods_name">{{ item.goods_name }}</view>
          <view class="goods_price">￥{{ item.goods_price }}</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
  import {
    setNavigationBarTitle
  } from "../../utils/setting.js"
  export default {
    data() {
      return {
        list: []
      }
    },
    onLoad(options) {
      this.list = JSON.parse(decodeURIComponent(options.list))
      setNavigationBarTitle({
        title: options.type === 'collect' ? '我的收藏' : options.type ===
          'history' ? '历史记录' : '订单详情'
      })
    },
    methods: {
      clickListItem(goods_id) {
        uni.navigateTo({
          url: "/pages/goods_detail/goods_detail?goods_id=" + goods_id,
        })
      },
    }

  }
</script>

<style lang="scss">
  .list {
    width: 100vw;
    height: 100vh;

    .content {
      .goods_item {
        display: flex;
        border-bottom: 2upx solid #ccc;
        height: 224upx;
        width: 100%;

        .goods_img_wrap {
          flex: 2;
          height: 100%;
          display: flex;
          justify-content: center;
          align-items: center;

          image {
            width: 70% !important;
            height: 70% !important;
          }
        }

        .goods_info_wrap {
          flex: 3;
          display: flex;
          flex-direction: column;
          justify-content: space-around;
          padding-right: 30upx;

          .goods_name {
            display: -webkit-box;
            overflow: hidden;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
          }

          .goods_price {
            color: #eb4450;
            font-size: 32upx;
          }
        }
      }
    }
  }
</style>
